// customheaderview.h
#ifndef CUSTOMHEADERVIEW_H
#define CUSTOMHEADERVIEW_H

#include <QHeaderView>
#include <QMap>

class CustomHeaderView : public QHeaderView {
public:
    CustomHeaderView(Qt::Orientation orientation, QWidget *parent = nullptr);

    void setHeaderData(const QMap<int, QVariant>& data);
    void setColumnWidths(const QMap<int, int>& widths);
    void setSectionHeight(int logicalIndex, int height);
    void setBackgroundColor(const QColor& color);
protected:
    void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override;
    QSize sectionSizeFromContents(int logicalIndex) const override;

private:
    QMap<int, QVariant> m_headerData;
    QMap<int, int> m_columnWidths;
    QMap<int, int> m_manualHeights; // 手动设置的高度
    QFont m_font;
    QColor m_textColor;
    QColor m_BackgroundColor;
};

#endif // CUSTOMHEADERVIEW_H
